﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="edge"/>
    <title>toSaas 接口文档</title>
    <link href="../css/css.css" rel="stylesheet">

    <link href="../css/css2.css" rel="stylesheet">
    <script src="../js/jquery-1.11.0.min.js"></script>

</head>
<body class="open-wrapper ">
<div class="page-wrapper">

    <header class="header" id="header">
        <div class="container">
        </div>
    </header>


    <div class="markdown">
        <h1 id="title">
            /user/login.do<span>(用户登录接口)</span>
        </h1>
        <div id="ant-api">
            <p>用户登录。本接口为开放性接口，可以加入验证码等防灌水措施。</p>

            <h2>请求地址</h2>
            <table>
                <tr>
                    <th>环境</th>
                    <th>HTTP POST 请求地址</th>
                </tr>
                <tr>
                    <td>正式环境</td>
                    <td>
                        https://域名/user/login.do
                    </td>
                </tr>
            </table>


            <h2>请求参数</h2>
            <table data-view="params">
                <tr>
                    <th class="prop-name">参数</th>
                    <th class="prop-type">类型</th>
                    <th class="prop-required">是否必填</th>
                    <th class="prop-max-length">最大长度</th>
                    <th class="prop-desc">描述</th>
                    <th class="prop-example">示例值</th>
                </tr>


                <tr data-depth="1">
                    <td>

                        name
                    </td>
                    <td>String</td>


                    <td>必选</td>

                    <td>50</td>
                    <td> 登录名</td>
                    <td> admin</td>
                </tr>


                <tr data-depth="1">
                    <td class="style1">

                        pwd
                    </td>
                    <td class="style1">String</td>


                    <td class="style1">必选</td>

                    <td class="style1">50</td>
                    <td class="style1"> 密码</td>
                    <td class="style1"> 123456</td>
                </tr>


            </table>



            <h2>响应参数</h2>


            <table data-view="params">
                <tr>
                    <th class="prop-name">参数</th>
                    <th class="prop-type">类型</th>
                    <th class="prop-required">是否必填</th>
                    <th class="prop-max-length">最大长度</th>
                    <th class="prop-desc">描述</th>
                    <th class="prop-example">示例值</th>
                </tr>


                <tr data-depth="1">
                    <td>

                        success
                    </td>
                    <td>boolean</td>


                    <td>必填</td>

                    <td>1</td>
                    <td> true 成功; false 失败</td>
                    <td> true</td>
                </tr>


                <tr data-depth="1">
                    <td>

                        code
                    </td>
                    <td>String</td>


                    <td> 必填</td>

                    <td>4</td>
                    <td> 错误码&nbsp; 0 正确</td>
                    <td> 0</td>
                </tr>


                <tr data-depth="1">
                    <td>massege</td>
                    <td>String</td>


                    <td> 必填</td>

                    <td>50</td>
                    <td> 错误信息</td>
                    <td> 成功</td>
                </tr>


                <tr>
                    <td>result</td>
                    <td>String</td>


                    <td> 选填</td>

                    <td>&nbsp;</td>
                    <td> 返回登录令牌token、用户信息</td>
                    <td> 见结果</td>
                </tr>


            </table>


            <h2>请求示例</h2>


            <div class="demo">
                <ul class="demo-tab">

                    <li data-id="3" class="">
                        <a class="title" href="#">HTTP请求源码</a>
                    </li>

                </ul>
                <div class="demo-tab-line"></div>

                <div class="demo-list">

                    <div class="code" data-id="0">
      
      <pre><code class="java">
            var content = {
                "content": {
                    "name": "admin",
                    "pwd": "123456"
                }
            }
           $.ajax({
               url: &quot;/user/login.do&quot;,
               type: &quot;POST&quot;,
               contentType: &quot;application/json;charset=UTF-8&quot;,
               data: JSON.stringify(content),
               dataType: &quot;json&quot;,
               success: function (data) {
                   console.log(data);
                   alert(JSON.stringify(data));
               }
           });
</code></pre>
                    </div>

                    <div><input type="button" value="调用测试" onclick="return onDebug();"
                                style="height: 33px; width: 129px"/> 用户名：<input id="username" value="admin" /> 
                        密码：<input id="pwd" type="password" value="123456" /> token:<input id="token" /></div>
                    <script type="text/javascript">
                        function onDebug() {
                            var content = {
                                "content": {
                                    "name": $("#username").val(),
                                    "pwd": $("#pwd").val()
                                }
                            }
                            $.ajax({
                                url: "/user/login.do",
                                type: "POST",
                                contentType: "application/json;charset=UTF-8",
                                data: JSON.stringify(content),
                                dataType: "json",
                                success: function (data) {
                                    console.log(data);
                                    $("#token").val(data.result.token);
                                    alert(JSON.stringify(data));
                                }
                            });
                        }
                    </script>

                </div>
            </div>


            <h2>响应示例</h2>

            <div class="demo">
                <ul class="demo-tab">

                    <li data-id="0" class="focus">
                        <a class="title" href="#">JSON 示例</a>
                    </li>

                </ul>
                <div class="demo-tab-line"></div>

                <div class="demo-list">

                    <div class="code" data-id="0">
      
      <pre>
      <code class="json">
{
	&quot;code&quot;: 0,
	&quot;success&quot;: true,
	&quot;massege&quot;: &quot;成功&quot;,
	&quot;result&quot;: {
		&quot;user&quot;: {
			&quot;id&quot;: &quot;5cdf58fe1e07f966f0605283&quot;,
			&quot;name&quot;: &quot;jack&quot;,
			&quot;pwd&quot;: null,
			&quot;nick&quot;: &quot;李明&quot;,
			&quot;phone&quot;: &quot;13800000000&quot;,
			&quot;created&quot;: &quot;2019-05-18T00:59:41.750+0000&quot;,
			&quot;company_id&quot;: null
		},
		&quot;token&quot;: &quot;7752e7b8cff94caf99525a3ad712b82b&quot;
	}
}
</code></pre>
                    </div>

                </div>
            </div>


            <h2>异常示例</h2>

            <div class="demo">
                <ul class="demo-tab">

                    <li data-id="0" class="focus">
                        <a class="title" href="#">JSON 示例</a>
                    </li>

                </ul>
                <div class="demo-tab-line"></div>

                <div class="demo-list">

                    <div class="code" data-id="0">
      
      <pre><code class="json">
{
	&quot;code&quot;: 2,
	&quot;success&quot;: false,
	&quot;massege&quot;: &quot;用户名密码错误！&quot;,
	&quot;result&quot;: null
}
</code></pre>
                    </div>

                </div>
            </div>


            <h2>错误码</h2>


            <table>
                <tr>
                    <th>错误码</th>
                    <th>错误描述</th>
                    <th>解决方案</th>
                </tr>

                <tr>
                    <td>1</td>
                    <td>参数校验错误</td>
                    <td>检查参数</td>
                </tr>

                <tr>
                    <td>2</td>
                    <td>业务数据校验错误</td>
                    <td>修改业务数据</td>
                </tr>

                <tr>
                    <td>99</td>
                    <td>未知异常</td>
                    <td></td>
                </tr>
            </table>


        </div>

        <style type="text/css">
            .iframe-comment {
                width: 100%;
                border: 0 none;
                overflow: hidden;
            }

            .comment-main {
                margin-top: 20px;
            }

            .style1 {
                height: 38px;
            }
            #token
            {
                width: 319px;
            }
        </style>
        <div id="comment-main" class="comment-main"></div>
    </div>

</body>
</html>
 
